package com.fly.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fly.bean.po.UserPo;
import com.fly.mapper.UserMapper;
import com.fly.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, UserPo> implements UserService {
    @Autowired
    private UserMapper userMapper;

    public void testMyBatisPlus() {
        // 插入数据
        UserPo userPo = new UserPo();
        userPo.setName("John");
        userPo.setAge("25");
        userPo.setAddress("john@example.com");
        userMapper.insert(userPo);

        // 查询数据
        UserPo dbUserPo = userMapper.selectById(userPo.getId());
        System.out.println(dbUserPo);
    }
}